import Page
from Page import Personal
from Base.Base import Base
from selenium.webdriver.common.by import By


class PersonalFeedresultPage(Base):
    """
     反馈结果页页面
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 左侧的home键
        self.result_home_btn = (By.XPATH, Personal.RESOURCE_ID.format("ivHome"))

        # 左侧的返回键
        self.result_back_btn = (By.XPATH, Personal.RESOURCE_ID.format('ivBack'))

        # 标题图标
        self.result_title_lift_icon = (By.XPATH, Personal.RESOURCE_ID.format("iv_thank_feedback_success"))

        # 标题提示语
        self.result_title_right_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_thank_feedback_desc"))

        # 回到首页按钮
        self.result_go_home_btn = (By.XPATH, Personal.RESOURCE_ID.format("back_feedback_home"))

    def click_home(self):
        """
        点击左侧的home键

        :return:None
        """
        self.click_element(self.result_home_btn)

    def click_back(self):
        """
        点击左侧的back键

        :return:None
        """
        self.click_element(self.result_back_btn)

    def get_title_lift(self):
        """
        获取标题图标

        :return:获取元素
        """
        return self.find_element_o(self.result_title_lift_icon)

    def get_title_right(self):
        """
        获取标题

        :return:获取元素
        """
        return self.find_element_o(self.result_title_right_text)

    def click_go_home(self):
        """
        点击回到首页按钮

        :return:None
        """
        self.click_element(self.result_go_home_btn)

    def is_display_personal_result(self):
        """
        是否存在反馈结果界面

        :return: bool
        """
        return self.is_display(self.result_title_right_text)
